package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.StrategyAttention;
import cn.wolfcode.trip.base.domain.StrategyComment;
import cn.wolfcode.trip.base.query.CollectQueryObject;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.query.StrategyCommentQueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;
/**
 *@Discription  攻略评论管理

 *@Params

 *@Return

 *@Authod  黄照伟

 *@CreationTime  2019/3/10 23:32

 *@change

 */


public interface StrategyCommentMapper {

    StrategyComment selectByCommentId(Long commentId);
    int deleteByPrimaryKey(Long id);

    StrategyComment selectByPrimaryKey(Long id);

    List<StrategyComment> selectAll();

    int updateByPrimaryKey(StrategyComment record);

    List<StrategyComment> selectForList(QueryObject qo);
    //分页
    List<StrategyComment> queryForList(QueryObject qo);

    //查询当前攻略被阅读次数
    int selectAssistCount(Long id);
    //查询当前攻略的所有评论
    List<StrategyComment> queryFoListApp(StrategyCommentQueryObject qo);
    //根据攻略文章的id查询评论
    StrategyComment selectStrategyCommentById(Long id);
    //查询攻略文章中某个用户的子评论数量
    int selectStrategyCommentCount(Long userId);
    //查询攻略文章中某个用户的所有子评论
    List<StrategyComment> selectStrategyCommentByUserId(Long id);
    //查询攻略文章的评论数量
    int selectStrategyCommentNum(Long id);

    //保存标签与点评关系
    //根据标签tagId和评论commentId添加id标签中间表
    void insertId(@Param("tagId") Long tagId, @Param("commentId") Long commentId);
    //重置用户数量
    void resetCount(Long userId);
    //更新数量关系
    void updateCountRelation();
    //保存子评论和主评论
    void save(@Param("addCommentId") Long addCommentId,
              @Param("strategyCommentId") Long strategyCommentId);
    //查询所有主评论
    List<StrategyComment> selectAllSubString();
    //攻略关联表
    StrategyAttention selectCollect(StrategyAttention attention);

    void deleteCollect(StrategyAttention attention);

    List<StrategyComment> getUserIdByCommentId(Long commentId);

    void saveCommentCollect(CollectQueryObject qo);

    void deleteCommentCollect(CollectQueryObject qo);

    Integer countCommentCollect(@Param("commentId") Long commentId);

    Integer commentIsCollect(@Param("userId") Long userId, @Param("commentId") Long commentId);

    List<StrategyComment> selectCommentCollectByUserId(@Param("userId") Long userId);
    void insert(StrategyComment strategyComment);

}